package com.config;

import org.apache.tomcat.util.threads.TaskQueue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.apache.tomcat.util.threads.ThreadPoolExecutor;

import java.util.concurrent.TimeUnit;

/**
 * @ClassName: TreandPoolConfig
 * @Author: ZhangYue26
 * @Description: 线程池配置
 * @Date: 2020-09-14
 */
@Configuration
public class TreandPoolConfig {

    @Bean
    public ThreadPoolExecutor getThreadPoolExecutor() {
        TaskQueue taskQueue = new TaskQueue();
        taskQueue.setForcedRemainingCapacity(20);
        return new ThreadPoolExecutor(10,20,50000, TimeUnit.SECONDS,taskQueue);
    }
}
